#!/bin/bash
#leao:Thu Aug 22 10:24:38 AM CST 2024
#!/bin/bash
link=0
plain=0
dir=0
path=$1
if [ ! -d "$path" ]; then
    echo "路径 $path 不存在或不是一个目录"
    exit 1
fi
for val in `ls -a $path`; do
    echo "$val"
    if [ $val != '.' -a $val != '..' ]
        then
             if [ -L "$1/$val" ]; then
                (( link++ ))
            elif [ -f "$1/$val" ]; then
                (( plain++ ))
            elif [ -d "$1/$val" ]; then
                (( dir++ ))

                    for subval in `ls -a $val`; do
                        echo $subval
                        if [ -L "$val/$subval" ]; then
                            (( link++ ))
                        elif [ -f "$val/$subval" ]; then
                            (( plain++ ))
                         elif [ -d "$val/$subval" ]; then
                            (( dir++ ))
                        fi
                    done
             fi       
    fi
done
echo "符号链接: $link"
echo "普通文件: $plain"
echo "目录: $dir"
